import { nearFarScalarItem } from "../utils/generator";
import {
  VerticalOrigin,
  TileMapServiceImageryProvider,
  buildModuleUrl,
} from "cesium";
export const normalOptions = () => {
  return {
    // 隐藏ui
    Animation: false,
    baseLayerPicker: false,
    fullscreenButton: false,
    vrButton: false,
    geocoder: false,
    infoBox: false,
    homeButton: false,
    sceneModePicker: false, //二三维
    selectionIndicator: false,
    timeline: false,
    navigationHelpButton: false,
    navigationInstructionsInitiallyVisible: false,
    // orderIndependentTranslucency: false,
    imageryProvider: new TileMapServiceImageryProvider({
      url: buildModuleUrl("Assets/Textures/NaturalEarthII"),
    }),
    contextOptions: {
      webgl: {
        alpha: true,
      },
    },
  };
};

export const editConstants = Object.freeze({
  NOEDITING: 0, //没有编辑的状态
  EDITING: 1, //正在编辑中
  EDITED: 2, //编辑完成，尚未保存
});

export const tagOptions = (options = {}) => {
  return {
    tag: {},
    position: { lng: 0, lat: 0 },
    verticalOrigin: VerticalOrigin.BOTTOM,
    scale: 0.3,
    scaleByDistance: nearFarScalarItem({
      near: 1000,
      nearValue: 1,
      far: 3000,
      farValue: 0.5,
    }),
    translucencyByDistance: nearFarScalarItem({
      near: 1000,
      nearValue: 1,
      far: 3000,
      farValue: 0.5,
    }),
    show: true,
    ...options,
  };
};

export const labelOptions = (options = {}) => {
  return {
    label: {},
    position: {},
    verticalOrigin: VerticalOrigin.CENTER,
    scale: 1,
    // scaleByDistance: nearFarScalarItem({
    // 	near: 1000,
    // 	nearValue: 1,
    // 	far: 5000,
    // 	farValue: 0.5,
    // }),
    show: true,
    ...options,
  };
};

export const pointOptions = (options = {}) => {
  return {
    point: {},
    position: {},
    verticalOrigin: VerticalOrigin.CENTER,
    scale: 1,
    show: true,
    ...options,
  };
};

export const ellipseOptions = (options = {}) => {
  return {
    ellipse: {},
    verticalOrigin: VerticalOrigin.CENTER,
    scale: 1,
    show: true,
    ...options,
  };
};
